package com.example.demo.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;


/**
 * 限流AOP
 *
 */
@Scope
@Aspect
@Component
public class LimitAspect {


    @Pointcut("@annotation(com.example.demo.annotation.ServiceLimit)")
    public void ServiceAspect(){

    }

    @Around("ServiceAspect()")
    public Object around(ProceedingJoinPoint proceedingJoinPoint){
        Boolean flag = false;
        Object object = null;
        try{
            if (flag){
                object = proceedingJoinPoint.proceed();
            }
        }catch (Throwable e){
            e.getStackTrace();
        }
        return proceedingJoinPoint;
    }
}
